import { defineStore } from 'pinia';
import { computed, ref } from 'vue';

// 这个函数我们一般起名格式形如：useXxxStore
export const useCounter2Store = defineStore('counter2', () => {
  const count = ref(0);

  const doubleCount = computed(() => count.value * 2);

  const addCount = () => {
    setTimeout(() => {
      count.value++;
    }, 1000);
  };

  return { count, addCount, doubleCount };
});
